#!/bin/sh
#  Trevor SANDY <trevor.sandy@gmail.com>
#  Last Update: March 06, 2019
#  Copyright (c) 2017 - 2020 by Trevor SANDY

prefix="$( cd "$( dirname "$0" )" && pwd )"
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib

usage="\
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libdir] [--cflags] [--ldflags ] [--ldlibs] [--libs] [--static-libs] [--static-libs-explicit]"

if test $# -eq 0; then
      echo "${usage}" 1>&2
      exit 1
fi

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo $exec_prefix
      ;;
    --version)
      echo 18.3.5
      ;;
    --libdir)
      echo -L${libdir}
      ;;
    --cflags)
      echo -I${prefix}/include
      ;;
	  --ldflags)
      echo -lm -lpthread -ldl
      ;;
    --ldlibs)
      echo -lOSMesa32 -lGLU
      ;;
    --libs)
      echo -L${exec_prefix}/lib -lOSMesa32 -lGLU
      ;;
    --static-libs)
      echo -L${exec_prefix}/lib -lOSMesa32 -GLU -lm -lpthread -ldl
      ;;
    --static-libs-explicit)
      echo ${exec_prefix}/lib/libOSMesa32.a ${exec_prefix}/lib/libGLU.a -lm -lpthread -ldl
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done
